import request from '@/utils/request'

// 查询Job列表
export function listJob(query) {
    return request({
        url: '/admin/v1/quartz/job/list',
        method: 'get',
        params: query
    })
}

// Job详情
export function detailJob(id) {
    return request({
        url: '/admin/v1/quartz/job/detail?id=' + id,
        method: 'get'
    })
}

// 新增Job
export function addJob(data) {
    return request({
        url: '/admin/v1/quartz/job/add',
        method: 'post',
        data: data
    })
}

// 更新Job
export function updateJob(data) {
    return request({
        url: '/admin/v1/quartz/job/update',
        method: 'post',
        data: data
    })
}

// 执行Job
export function runJob(data) {
    return request({
        url: '/admin/v1/quartz/job/run',
        method: 'post',
        data: data
    })
}

// 删除Job
export function delJob(id) {
    return request({
        url: '/admin/v1/quartz/job/delete?id=' + id,
        method: 'delete'
    })
}

// 批量删除Job
export function delBatchJob(ids) {
    return request({
        url: '/admin/v1/quartz/job/deleteBatch?ids=' + ids,
        method: 'delete'
    })
}

// 暂停Job
export function pauseJob(id) {
    return request({
        url: '/admin/v1/quartz/job/pause?id=' + id,
        method: 'get'
    })
}

// 恢复Job
export function resumeJob(id) {
    return request({
        url: '/admin/v1/quartz/job/resume?id=' + id,
        method: 'get'
    })
}

// 查询运行日志
export function getJobLog(id) {
    return request({
        url: '/admin/v1/quartz/job/log?id=' + id,
        method: 'get'
    })
}